package cn.z2huo.knowledge.collection.list.arraylist;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *
 * @author z2huo
 */
public class ToArrayTest {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>(List.of("1", "2", "3", "5", "6", "9"));

        String[] array = new String[8];
        array[0] = "a";
        array[1] = "b";
        array[2] = "c";
        array[3] = "d";
        array[4] = "e";
        array[5] = "f";
        array[6] = "g";
        array[7] = "h";

        System.out.println(list);
        System.out.println(Arrays.toString(array));
        System.out.println(array.getClass());
        System.out.println(array);

        String[] listArray = list.toArray(array);
        System.out.println(Arrays.toString(listArray));
        System.out.println(listArray);
    }
}
